
class Url {
  public decode(info) {
    var MYURL: Url = new Url();
    window['MYURL'] = MYURL;
    var data = '';
    for (var i = 0; i < info.length; i++) {
      var str = info[i].toString(16);
      var n1 = ("%" + str.substring(2, 4)).toUpperCase();
      var n2 = ("%" + str.substring(0, 2)).toUpperCase();
      var s = n1 + n2;
      if (info[i] <= 127) {
        s = s.substring(1)
      }
      try {
        var str = window['$URL'].decode(s);
      } catch (e) {
          str =''; 
      }
      if (str == "%D"){
        str = "\r"
      }
      if (str == "%A"){
        str = "\n"
      }
      data += str;
    }
    return data;
  }

  public encode(info) {
    var MYURL: Url = new Url();
    window['MYURL'] = MYURL;
    var data = window['$URL'].encode(info);
    var str1 = data.substring(1, 3)
    var str2 = data.substring(4, 6)
    var allStr = str2 + str1
    var num10 = parseInt(allStr, 16)
    return num10;
  }
  public md5(info) {
    var MYURL: Url = new Url();
    window['MYURL'] = MYURL;
    var data = window['$URL'].encode(info);
    var str1 = data.substring(1, 3)
    var str2 = data.substring(4, 6)
    var allStr = str2 + str1
    var num10 = parseInt(allStr, 16)
    return num10;
  }
}